<?php
class ResearchAction extends PublicAction {
	
    public function index(){		
	    $research_cate = research_list();
		$cid  = isset($_GET['cid'])?I('get.cid'):$research_cate[0]['cate_id'];
		$researchs = M()->query("SELECT i.* ,id.* FROM cms_program i JOIN cms_program_description id ON i.inner_id = id.inner_id,cms_program_cate_to_program c2i 
							 WHERE i.status = 1 and i.inner_id  = c2i.inner_id and id.language_id = '".L('lan_id')."' and c2i.cate_id = '".$cid."'
							 ORDER BY i.sort_order desc,id.inner_title asc");
		$title = M()->query('select cate_name,cate_description from cms_program_cate_description where language_id = '.L('lan_id').' and cate_id = '.$cid.'');
		$this->title 		 =  $title[0]['cate_name'];
		$this->description 	 =  $title[0]['cate_description'];
		$this->research_cate =  $research_cate;
		$this->researchs 	 =  $researchs;
		$this->display();
	}
	public function archive_program()
	{
		$research_cate = research_list();
		$this->research_cate =  $research_cate;
		$this->display();
	}
	public function detail()
	{
		$id = I('get.id');
		$research = M()->query("SELECT i.* ,id.*,c2i.cate_id FROM cms_program i JOIN cms_program_description id ON i.inner_id = id.inner_id,cms_program_cate_to_program c2i 
								 WHERE i.status = 1 and i.inner_id  = c2i.inner_id and id.language_id = '".L('lan_id')."' and i.inner_id = '".$id."'");
		$research_cate = research_list();
		$this->research_cate =  $research_cate;
		$this->research =  $research[0];
		$this->display();
	}
	
	
}